package com.apabi.web.controller.api;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.apabi.service.ApiMateService;
import com.apabi.service.elastic.APICode;
import com.apabi.service.elastic.APIResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * Created by teng on 2018/1/16.
 */
@Controller
@RequestMapping("/api/meta")
public class MetaController {

    @Autowired
    private ApiMateService apiMateService;

    /**
     * 7大库元数据获取
     * url:/api/meta/detail/{docId}
     * @param docId
     * @return
     */
    @RequestMapping(value = "/detail/{docId}",method = RequestMethod.GET)
    public @ResponseBody  APIResult detail(@PathVariable String docId) {
        Map<String,String> doc = apiMateService.selectDoc(docId);
        return new APIResult(APICode.SUCCESS,doc);
    }
}
